{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Stacking"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<div class=\"alert alert-info\">\n",
    "\n",
    "This tutorial is available as an IPython notebook at [Malaya/example/stacking](https://github.com/huseinzol05/Malaya/tree/master/example/stacking).\n",
    "    \n",
    "</div>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Why Stacking?\n",
    "\n",
    "Sometime a single model is not good enough. So, you need to use multiple models to get a better result! It called stacking."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 2.91 s, sys: 2.59 s, total: 5.49 s\n",
      "Wall time: 2.45 s\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/husein/dev/malaya/malaya/tokenizer.py:214: FutureWarning: Possible nested set at position 3397\n",
      "  self.tok = re.compile(r'({})'.format('|'.join(pipeline)))\n",
      "/home/husein/dev/malaya/malaya/tokenizer.py:214: FutureWarning: Possible nested set at position 3927\n",
      "  self.tok = re.compile(r'({})'.format('|'.join(pipeline)))\n"
     ]
    }
   ],
   "source": [
    "%%time\n",
    "import malaya"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'mesolitica/sentiment-analysis-nanot5-tiny-malaysian-cased': {'Size (MB)': 93,\n",
       "  'macro precision': 0.67768,\n",
       "  'macro recall': 0.68266,\n",
       "  'macro f1-score': 0.67997},\n",
       " 'mesolitica/sentiment-analysis-nanot5-small-malaysian-cased': {'Size (MB)': 167,\n",
       "  'macro precision': 0.67602,\n",
       "  'macro recall': 0.6712,\n",
       "  'macro f1-score': 0.67339}}"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "malaya.sentiment.available_huggingface"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "tiny = malaya.sentiment.huggingface(model = 'mesolitica/sentiment-analysis-nanot5-tiny-malaysian-cased')\n",
    "small = malaya.sentiment.huggingface(model = 'mesolitica/sentiment-analysis-nanot5-small-malaysian-cased')\n",
    "multinomial = malaya.sentiment.multinomial()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Stack multiple sentiment models"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`malaya.stack.predict_stack` provide an easy stacking solution for Malaya models. Well, not just for sentiment models, any classification models can use `malaya.stack.predict_stack`.\n",
    "\n",
    "```python\n",
    "def predict_stack(\n",
    "    models, strings: List[str], aggregate: Callable = gmean, **kwargs\n",
    "):\n",
    "    \"\"\"\n",
    "    Stacking for predictive models.\n",
    "\n",
    "    Parameters\n",
    "    ----------\n",
    "    models: List[Callable]\n",
    "        list of models.\n",
    "    strings: List[str]\n",
    "    aggregate : Callable, optional (default=scipy.stats.mstats.gmean)\n",
    "        Aggregate function.\n",
    "\n",
    "    Returns\n",
    "    -------\n",
    "    result: dict\n",
    "    \"\"\"\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/husein/dev/malaya/malaya/model/stem.py:28: FutureWarning: Possible nested set at position 3\n",
      "  or re.findall(_expressions['ic'], word.lower())\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[{'negative': 0.6198190231869043,\n",
       "  'neutral': 0.20203009823814663,\n",
       "  'positive': 0.0405395204541597}]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "malaya.stack.predict_stack([tiny, small, multinomial],\n",
    "                          ['harga minyak tak menentu'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Stack tagging models"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "For tagging models, we use majority voting stacking. So you need to need have more than 2 models to make it perfect, or else, it will pick randomly from 2 models. `malaya.stack.voting_stack` provides easy interface for this kind of stacking. **But only can use for Entites, POS and Dependency Parsing recognition.**\n",
    "\n",
    "```python\n",
    "def voting_stack(models, text):\n",
    "    \"\"\"\n",
    "    Stacking for POS and Entities Recognition models.\n",
    "\n",
    "    Parameters\n",
    "    ----------\n",
    "    models: list\n",
    "        list of models\n",
    "    text: str\n",
    "        string to predict\n",
    "\n",
    "    Returns\n",
    "    -------\n",
    "    result: list\n",
    "    \"\"\"\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.\n",
      "Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.\n",
      "Asking to truncate to max_length but no maximum length is provided and the model has no predefined maximum length. Default to no truncation.\n",
      "Asking to truncate to max_length but no maximum length is provided and the model has no predefined maximum length. Default to no truncation.\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[('KUALA', 'PROPN'),\n",
       " ('LUMPUR:', 'PROPN'),\n",
       " ('Sempena', 'PROPN'),\n",
       " ('sambutan', 'NOUN'),\n",
       " ('Aidilfitri', 'PROPN'),\n",
       " ('minggu', 'NOUN'),\n",
       " ('depan,', 'ADJ'),\n",
       " ('Perdana', 'PROPN'),\n",
       " ('Menteri', 'PROPN'),\n",
       " ('Tun', 'PROPN'),\n",
       " ('Dr', 'PROPN'),\n",
       " ('Mahathir', 'PROPN'),\n",
       " ('Mohamad', 'PROPN'),\n",
       " ('dan', 'CCONJ'),\n",
       " ('Menteri', 'PROPN'),\n",
       " ('Pengangkutan', 'PROPN'),\n",
       " ('Anthony', 'PROPN'),\n",
       " ('Loke', 'PROPN'),\n",
       " ('Siew', 'PROPN'),\n",
       " ('Fook', 'PROPN'),\n",
       " ('menitipkan', 'VERB'),\n",
       " ('pesanan', 'NOUN'),\n",
       " ('khas', 'ADJ'),\n",
       " ('kepada', 'ADP'),\n",
       " ('orang', 'NOUN'),\n",
       " ('ramai', 'NOUN'),\n",
       " ('yang', 'PRON'),\n",
       " ('mahu', 'ADV'),\n",
       " ('pulang', 'VERB'),\n",
       " ('ke', 'ADP'),\n",
       " ('kampung', 'NOUN'),\n",
       " ('halaman', 'NOUN'),\n",
       " ('masing-masing.', 'DET'),\n",
       " ('Dalam', 'ADP'),\n",
       " ('video', 'NOUN'),\n",
       " ('pendek', 'ADJ'),\n",
       " ('terbitan', 'NOUN'),\n",
       " ('Jabatan', 'PROPN'),\n",
       " ('Keselamatan', 'PROPN'),\n",
       " ('Jalan', 'PROPN'),\n",
       " ('Raya', 'PROPN'),\n",
       " ('(JKJR)', 'PUNCT'),\n",
       " ('itu,', 'DET'),\n",
       " ('Dr', 'PROPN'),\n",
       " ('Mahathir', 'PROPN'),\n",
       " ('menasihati', 'VERB'),\n",
       " ('mereka', 'PRON'),\n",
       " ('supaya', 'NOUN'),\n",
       " ('berhenti', 'VERB'),\n",
       " ('berehat', 'VERB'),\n",
       " ('dan', 'CCONJ'),\n",
       " ('tidur', 'VERB'),\n",
       " ('sebentar', 'ADV'),\n",
       " ('sekiranya', 'ADV'),\n",
       " ('mengantuk', 'VERB'),\n",
       " ('ketika', 'SCONJ'),\n",
       " ('memandu.', 'VERB')]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "string = 'KUALA LUMPUR: Sempena sambutan Aidilfitri minggu depan, Perdana Menteri Tun Dr Mahathir Mohamad dan Menteri Pengangkutan Anthony Loke Siew Fook menitipkan pesanan khas kepada orang ramai yang mahu pulang ke kampung halaman masing-masing. Dalam video pendek terbitan Jabatan Keselamatan Jalan Raya (JKJR) itu, Dr Mahathir menasihati mereka supaya berhenti berehat dan tidur sebentar  sekiranya mengantuk ketika memandu.'\n",
    "\n",
    "tiny = malaya.pos.huggingface('mesolitica/pos-t5-tiny-standard-bahasa-cased')\n",
    "small = malaya.pos.huggingface('mesolitica/pos-t5-small-standard-bahasa-cased')\n",
    "malaya.stack.voting_stack([tiny, small, small], string)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "string = 'KUALA LUMPUR: Sempena sambutan Aidilfitri minggu depan, Perdana Menteri Tun Dr Mahathir Mohamad dan Menteri Pengangkutan Anthony Loke Siew Fook menitipkan pesanan khas kepada orang ramai yang mahu pulang ke kampung halaman masing-masing. Dalam video pendek terbitan Jabatan Keselamatan Jalan Raya (JKJR) itu, Dr Mahathir menasihati mereka supaya berhenti berehat dan tidur sebentar  sekiranya mengantuk ketika memandu.'\n",
    "\n",
    "tiny = malaya.dependency.huggingface(model = 'mesolitica/finetune-dependency-t5-tiny-standard-bahasa-cased')\n",
    "small = malaya.dependency.huggingface(model = 'mesolitica/finetune-dependency-t5-small-standard-bahasa-cased')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "You're using a T5TokenizerFast tokenizer. Please note that with a fast tokenizer, using the `__call__` method is faster than using a method to encode the text followed by a call to the `pad` method to get a padded encoding.\n",
      "You're using a T5TokenizerFast tokenizer. Please note that with a fast tokenizer, using the `__call__` method is faster than using a method to encode the text followed by a call to the `pad` method to get a padded encoding.\n",
      "huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...\n",
      "To disable this warning, you can either:\n",
      "\t- Avoid using `tokenizers` before the fork if possible\n",
      "\t- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)\n"
     ]
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<!-- Generated by graphviz version 2.43.0 (0)\n",
       " -->\n",
       "<!-- Title: G Pages: 1 -->\n",
       "<svg width=\"1792pt\" height=\"914pt\"\n",
       " viewBox=\"0.00 0.00 1792.00 914.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
       "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 910)\">\n",
       "<title>G</title>\n",
       "<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-910 1788,-910 1788,4 -4,4\"/>\n",
       "<!-- 0 -->\n",
       "<g id=\"node1\" class=\"node\">\n",
       "<title>0</title>\n",
       "<text text-anchor=\"middle\" x=\"579.5\" y=\"-884.3\" font-family=\"Times,serif\" font-size=\"14.00\">0 (None)</text>\n",
       "</g>\n",
       "<!-- 21 -->\n",
       "<g id=\"node2\" class=\"node\">\n",
       "<title>21</title>\n",
       "<text text-anchor=\"middle\" x=\"579.5\" y=\"-797.3\" font-family=\"Times,serif\" font-size=\"14.00\">21 (menitipkan)</text>\n",
       "</g>\n",
       "<!-- 0&#45;&gt;21 -->\n",
       "<g id=\"edge1\" class=\"edge\">\n",
       "<title>0&#45;&gt;21</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M579.5,-869.8C579.5,-858.16 579.5,-842.55 579.5,-829.24\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"583,-829.18 579.5,-819.18 576,-829.18 583,-829.18\"/>\n",
       "<text text-anchor=\"middle\" x=\"594.5\" y=\"-840.8\" font-family=\"Times,serif\" font-size=\"14.00\">root</text>\n",
       "</g>\n",
       "<!-- 1 -->\n",
       "<g id=\"node3\" class=\"node\">\n",
       "<title>1</title>\n",
       "<text text-anchor=\"middle\" x=\"266.5\" y=\"-710.3\" font-family=\"Times,serif\" font-size=\"14.00\">1 (KUALA)</text>\n",
       "</g>\n",
       "<!-- 21&#45;&gt;1 -->\n",
       "<g id=\"edge21\" class=\"edge\">\n",
       "<title>21&#45;&gt;1</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M514.46,-783.93C491.38,-778.11 465.25,-771.4 441.5,-765 401.24,-754.15 355.98,-741.19 321.58,-731.19\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"322.3,-727.76 311.72,-728.32 320.34,-734.48 322.3,-727.76\"/>\n",
       "<text text-anchor=\"middle\" x=\"461.5\" y=\"-753.8\" font-family=\"Times,serif\" font-size=\"14.00\">nsubj</text>\n",
       "</g>\n",
       "<!-- 22 -->\n",
       "<g id=\"node23\" class=\"node\">\n",
       "<title>22</title>\n",
       "<text text-anchor=\"middle\" x=\"410.5\" y=\"-710.3\" font-family=\"Times,serif\" font-size=\"14.00\">22 (pesanan)</text>\n",
       "</g>\n",
       "<!-- 21&#45;&gt;22 -->\n",
       "<g id=\"edge22\" class=\"edge\">\n",
       "<title>21&#45;&gt;22</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M545.3,-782.8C518.76,-769.45 481.8,-750.86 453.29,-736.52\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"454.87,-733.4 444.36,-732.03 451.72,-739.65 454.87,-733.4\"/>\n",
       "<text text-anchor=\"middle\" x=\"516.5\" y=\"-753.8\" font-family=\"Times,serif\" font-size=\"14.00\">obj</text>\n",
       "</g>\n",
       "<!-- 25 -->\n",
       "<g id=\"node24\" class=\"node\">\n",
       "<title>25</title>\n",
       "<text text-anchor=\"middle\" x=\"579.5\" y=\"-710.3\" font-family=\"Times,serif\" font-size=\"14.00\">25 (orang)</text>\n",
       "</g>\n",
       "<!-- 21&#45;&gt;25 -->\n",
       "<g id=\"edge23\" class=\"edge\">\n",
       "<title>21&#45;&gt;25</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M579.5,-782.8C579.5,-771.16 579.5,-755.55 579.5,-742.24\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"583,-742.18 579.5,-732.18 576,-742.18 583,-742.18\"/>\n",
       "<text text-anchor=\"middle\" x=\"590.5\" y=\"-753.8\" font-family=\"Times,serif\" font-size=\"14.00\">obl</text>\n",
       "</g>\n",
       "<!-- 33 -->\n",
       "<g id=\"node25\" class=\"node\">\n",
       "<title>33</title>\n",
       "<text text-anchor=\"middle\" x=\"724.5\" y=\"-710.3\" font-family=\"Times,serif\" font-size=\"14.00\">33 (masing&#45;masing.)</text>\n",
       "</g>\n",
       "<!-- 21&#45;&gt;33 -->\n",
       "<g id=\"edge24\" class=\"edge\">\n",
       "<title>21&#45;&gt;33</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M608.84,-782.8C631.15,-769.72 662.03,-751.62 686.27,-737.41\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"688.34,-740.25 695.2,-732.18 684.8,-734.21 688.34,-740.25\"/>\n",
       "<text text-anchor=\"middle\" x=\"682\" y=\"-753.8\" font-family=\"Times,serif\" font-size=\"14.00\">punct</text>\n",
       "</g>\n",
       "<!-- 46 -->\n",
       "<g id=\"node26\" class=\"node\">\n",
       "<title>46</title>\n",
       "<text text-anchor=\"middle\" x=\"1115.5\" y=\"-710.3\" font-family=\"Times,serif\" font-size=\"14.00\">46 (menasihati)</text>\n",
       "</g>\n",
       "<!-- 21&#45;&gt;46 -->\n",
       "<g id=\"edge25\" class=\"edge\">\n",
       "<title>21&#45;&gt;46</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M644.69,-789.66C744.83,-773.78 935.94,-743.48 1041.26,-726.77\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1041.85,-730.22 1051.18,-725.2 1040.76,-723.31 1041.85,-730.22\"/>\n",
       "<text text-anchor=\"middle\" x=\"914\" y=\"-753.8\" font-family=\"Times,serif\" font-size=\"14.00\">parataxis</text>\n",
       "</g>\n",
       "<!-- 2 -->\n",
       "<g id=\"node4\" class=\"node\">\n",
       "<title>2</title>\n",
       "<text text-anchor=\"middle\" x=\"88.5\" y=\"-623.3\" font-family=\"Times,serif\" font-size=\"14.00\">2 (LUMPUR:)</text>\n",
       "</g>\n",
       "<!-- 1&#45;&gt;2 -->\n",
       "<g id=\"edge2\" class=\"edge\">\n",
       "<title>1&#45;&gt;2</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M230.48,-695.8C202.52,-682.45 163.6,-663.86 133.57,-649.52\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"134.7,-646.18 124.16,-645.03 131.68,-652.5 134.7,-646.18\"/>\n",
       "<text text-anchor=\"middle\" x=\"200.5\" y=\"-666.8\" font-family=\"Times,serif\" font-size=\"14.00\">flat</text>\n",
       "</g>\n",
       "<!-- 4 -->\n",
       "<g id=\"node5\" class=\"node\">\n",
       "<title>4</title>\n",
       "<text text-anchor=\"middle\" x=\"266.5\" y=\"-623.3\" font-family=\"Times,serif\" font-size=\"14.00\">4 (sambutan)</text>\n",
       "</g>\n",
       "<!-- 1&#45;&gt;4 -->\n",
       "<g id=\"edge3\" class=\"edge\">\n",
       "<title>1&#45;&gt;4</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M266.5,-695.8C266.5,-684.16 266.5,-668.55 266.5,-655.24\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"270,-655.18 266.5,-645.18 263,-655.18 270,-655.18\"/>\n",
       "<text text-anchor=\"middle\" x=\"303.5\" y=\"-666.8\" font-family=\"Times,serif\" font-size=\"14.00\">compound</text>\n",
       "</g>\n",
       "<!-- 3 -->\n",
       "<g id=\"node6\" class=\"node\">\n",
       "<title>3</title>\n",
       "<text text-anchor=\"middle\" x=\"53.5\" y=\"-536.3\" font-family=\"Times,serif\" font-size=\"14.00\">3 (Sempena)</text>\n",
       "</g>\n",
       "<!-- 2&#45;&gt;3 -->\n",
       "<g id=\"edge4\" class=\"edge\">\n",
       "<title>2&#45;&gt;3</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M81.42,-608.8C76.53,-596.93 69.94,-580.93 64.39,-567.45\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"67.62,-566.09 60.57,-558.18 61.14,-568.75 67.62,-566.09\"/>\n",
       "<text text-anchor=\"middle\" x=\"85.5\" y=\"-579.8\" font-family=\"Times,serif\" font-size=\"14.00\">flat</text>\n",
       "</g>\n",
       "<!-- 5 -->\n",
       "<g id=\"node7\" class=\"node\">\n",
       "<title>5</title>\n",
       "<text text-anchor=\"middle\" x=\"174.5\" y=\"-536.3\" font-family=\"Times,serif\" font-size=\"14.00\">5 (Aidilfitri)</text>\n",
       "</g>\n",
       "<!-- 4&#45;&gt;5 -->\n",
       "<g id=\"edge5\" class=\"edge\">\n",
       "<title>4&#45;&gt;5</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M247.88,-608.8C234.29,-596.24 215.68,-579.05 200.61,-565.12\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"202.81,-562.39 193.09,-558.18 198.06,-567.53 202.81,-562.39\"/>\n",
       "<text text-anchor=\"middle\" x=\"238.5\" y=\"-579.8\" font-family=\"Times,serif\" font-size=\"14.00\">flat</text>\n",
       "</g>\n",
       "<!-- 7 -->\n",
       "<g id=\"node8\" class=\"node\">\n",
       "<title>7</title>\n",
       "<text text-anchor=\"middle\" x=\"286.5\" y=\"-536.3\" font-family=\"Times,serif\" font-size=\"14.00\">7 (depan,)</text>\n",
       "</g>\n",
       "<!-- 4&#45;&gt;7 -->\n",
       "<g id=\"edge6\" class=\"edge\">\n",
       "<title>4&#45;&gt;7</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M270.55,-608.8C273.29,-597.16 276.96,-581.55 280.09,-568.24\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"283.58,-568.71 282.46,-558.18 276.76,-567.11 283.58,-568.71\"/>\n",
       "<text text-anchor=\"middle\" x=\"299\" y=\"-579.8\" font-family=\"Times,serif\" font-size=\"14.00\">punct</text>\n",
       "</g>\n",
       "<!-- 8 -->\n",
       "<g id=\"node9\" class=\"node\">\n",
       "<title>8</title>\n",
       "<text text-anchor=\"middle\" x=\"398.5\" y=\"-536.3\" font-family=\"Times,serif\" font-size=\"14.00\">8 (Perdana)</text>\n",
       "</g>\n",
       "<!-- 4&#45;&gt;8 -->\n",
       "<g id=\"edge7\" class=\"edge\">\n",
       "<title>4&#45;&gt;8</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M294.75,-608.94C303.96,-603.3 314.21,-596.95 323.5,-591 337.1,-582.3 351.92,-572.48 364.77,-563.87\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"366.97,-566.62 373.31,-558.13 363.06,-560.81 366.97,-566.62\"/>\n",
       "<text text-anchor=\"middle\" x=\"368\" y=\"-579.8\" font-family=\"Times,serif\" font-size=\"14.00\">appos</text>\n",
       "</g>\n",
       "<!-- 6 -->\n",
       "<g id=\"node10\" class=\"node\">\n",
       "<title>6</title>\n",
       "<text text-anchor=\"middle\" x=\"174.5\" y=\"-449.3\" font-family=\"Times,serif\" font-size=\"14.00\">6 (minggu)</text>\n",
       "</g>\n",
       "<!-- 5&#45;&gt;6 -->\n",
       "<g id=\"edge8\" class=\"edge\">\n",
       "<title>5&#45;&gt;6</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M174.5,-521.8C174.5,-510.16 174.5,-494.55 174.5,-481.24\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"178,-481.18 174.5,-471.18 171,-481.18 178,-481.18\"/>\n",
       "<text text-anchor=\"middle\" x=\"186.5\" y=\"-492.8\" font-family=\"Times,serif\" font-size=\"14.00\">flat</text>\n",
       "</g>\n",
       "<!-- 9 -->\n",
       "<g id=\"node11\" class=\"node\">\n",
       "<title>9</title>\n",
       "<text text-anchor=\"middle\" x=\"338.5\" y=\"-449.3\" font-family=\"Times,serif\" font-size=\"14.00\">9 (Menteri)</text>\n",
       "</g>\n",
       "<!-- 8&#45;&gt;9 -->\n",
       "<g id=\"edge9\" class=\"edge\">\n",
       "<title>8&#45;&gt;9</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M386.36,-521.8C377.82,-509.7 366.24,-493.3 356.62,-479.67\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"359.25,-477.33 350.62,-471.18 353.53,-481.36 359.25,-477.33\"/>\n",
       "<text text-anchor=\"middle\" x=\"384.5\" y=\"-492.8\" font-family=\"Times,serif\" font-size=\"14.00\">flat</text>\n",
       "</g>\n",
       "<!-- 15 -->\n",
       "<g id=\"node12\" class=\"node\">\n",
       "<title>15</title>\n",
       "<text text-anchor=\"middle\" x=\"459.5\" y=\"-449.3\" font-family=\"Times,serif\" font-size=\"14.00\">15 (Menteri)</text>\n",
       "</g>\n",
       "<!-- 8&#45;&gt;15 -->\n",
       "<g id=\"edge10\" class=\"edge\">\n",
       "<title>8&#45;&gt;15</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M410.84,-521.8C419.53,-509.7 431.29,-493.3 441.08,-479.67\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"444.19,-481.34 447.17,-471.18 438.5,-477.26 444.19,-481.34\"/>\n",
       "<text text-anchor=\"middle\" x=\"448.5\" y=\"-492.8\" font-family=\"Times,serif\" font-size=\"14.00\">conj</text>\n",
       "</g>\n",
       "<!-- 10 -->\n",
       "<g id=\"node13\" class=\"node\">\n",
       "<title>10</title>\n",
       "<text text-anchor=\"middle\" x=\"338.5\" y=\"-362.3\" font-family=\"Times,serif\" font-size=\"14.00\">10 (Tun)</text>\n",
       "</g>\n",
       "<!-- 9&#45;&gt;10 -->\n",
       "<g id=\"edge11\" class=\"edge\">\n",
       "<title>9&#45;&gt;10</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M338.5,-434.8C338.5,-423.16 338.5,-407.55 338.5,-394.24\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"342,-394.18 338.5,-384.18 335,-394.18 342,-394.18\"/>\n",
       "<text text-anchor=\"middle\" x=\"350.5\" y=\"-405.8\" font-family=\"Times,serif\" font-size=\"14.00\">flat</text>\n",
       "</g>\n",
       "<!-- 14 -->\n",
       "<g id=\"node17\" class=\"node\">\n",
       "<title>14</title>\n",
       "<text text-anchor=\"middle\" x=\"446.5\" y=\"-362.3\" font-family=\"Times,serif\" font-size=\"14.00\">14 (dan)</text>\n",
       "</g>\n",
       "<!-- 15&#45;&gt;14 -->\n",
       "<g id=\"edge15\" class=\"edge\">\n",
       "<title>15&#45;&gt;14</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M456.87,-434.8C455.09,-423.16 452.7,-407.55 450.67,-394.24\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"454.1,-393.53 449.13,-384.18 447.18,-394.59 454.1,-393.53\"/>\n",
       "<text text-anchor=\"middle\" x=\"462.5\" y=\"-405.8\" font-family=\"Times,serif\" font-size=\"14.00\">cc</text>\n",
       "</g>\n",
       "<!-- 16 -->\n",
       "<g id=\"node18\" class=\"node\">\n",
       "<title>16</title>\n",
       "<text text-anchor=\"middle\" x=\"578.5\" y=\"-362.3\" font-family=\"Times,serif\" font-size=\"14.00\">16 (Pengangkutan)</text>\n",
       "</g>\n",
       "<!-- 15&#45;&gt;16 -->\n",
       "<g id=\"edge16\" class=\"edge\">\n",
       "<title>15&#45;&gt;16</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M483.58,-434.8C501.57,-421.95 526.34,-404.26 546.07,-390.17\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"548.35,-392.84 554.45,-384.18 544.28,-387.14 548.35,-392.84\"/>\n",
       "<text text-anchor=\"middle\" x=\"538.5\" y=\"-405.8\" font-family=\"Times,serif\" font-size=\"14.00\">flat</text>\n",
       "</g>\n",
       "<!-- 11 -->\n",
       "<g id=\"node14\" class=\"node\">\n",
       "<title>11</title>\n",
       "<text text-anchor=\"middle\" x=\"338.5\" y=\"-275.3\" font-family=\"Times,serif\" font-size=\"14.00\">11 (Dr)</text>\n",
       "</g>\n",
       "<!-- 10&#45;&gt;11 -->\n",
       "<g id=\"edge12\" class=\"edge\">\n",
       "<title>10&#45;&gt;11</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M338.5,-347.8C338.5,-336.16 338.5,-320.55 338.5,-307.24\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"342,-307.18 338.5,-297.18 335,-307.18 342,-307.18\"/>\n",
       "<text text-anchor=\"middle\" x=\"350.5\" y=\"-318.8\" font-family=\"Times,serif\" font-size=\"14.00\">flat</text>\n",
       "</g>\n",
       "<!-- 12 -->\n",
       "<g id=\"node15\" class=\"node\">\n",
       "<title>12</title>\n",
       "<text text-anchor=\"middle\" x=\"338.5\" y=\"-188.3\" font-family=\"Times,serif\" font-size=\"14.00\">12 (Mahathir)</text>\n",
       "</g>\n",
       "<!-- 11&#45;&gt;12 -->\n",
       "<g id=\"edge13\" class=\"edge\">\n",
       "<title>11&#45;&gt;12</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M338.5,-260.8C338.5,-249.16 338.5,-233.55 338.5,-220.24\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"342,-220.18 338.5,-210.18 335,-220.18 342,-220.18\"/>\n",
       "<text text-anchor=\"middle\" x=\"350.5\" y=\"-231.8\" font-family=\"Times,serif\" font-size=\"14.00\">flat</text>\n",
       "</g>\n",
       "<!-- 13 -->\n",
       "<g id=\"node16\" class=\"node\">\n",
       "<title>13</title>\n",
       "<text text-anchor=\"middle\" x=\"338.5\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\">13 (Mohamad)</text>\n",
       "</g>\n",
       "<!-- 12&#45;&gt;13 -->\n",
       "<g id=\"edge14\" class=\"edge\">\n",
       "<title>12&#45;&gt;13</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M338.5,-173.8C338.5,-162.16 338.5,-146.55 338.5,-133.24\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"342,-133.18 338.5,-123.18 335,-133.18 342,-133.18\"/>\n",
       "<text text-anchor=\"middle\" x=\"350.5\" y=\"-144.8\" font-family=\"Times,serif\" font-size=\"14.00\">flat</text>\n",
       "</g>\n",
       "<!-- 17 -->\n",
       "<g id=\"node19\" class=\"node\">\n",
       "<title>17</title>\n",
       "<text text-anchor=\"middle\" x=\"578.5\" y=\"-275.3\" font-family=\"Times,serif\" font-size=\"14.00\">17 (Anthony)</text>\n",
       "</g>\n",
       "<!-- 16&#45;&gt;17 -->\n",
       "<g id=\"edge17\" class=\"edge\">\n",
       "<title>16&#45;&gt;17</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M578.5,-347.8C578.5,-336.16 578.5,-320.55 578.5,-307.24\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"582,-307.18 578.5,-297.18 575,-307.18 582,-307.18\"/>\n",
       "<text text-anchor=\"middle\" x=\"590.5\" y=\"-318.8\" font-family=\"Times,serif\" font-size=\"14.00\">flat</text>\n",
       "</g>\n",
       "<!-- 18 -->\n",
       "<g id=\"node20\" class=\"node\">\n",
       "<title>18</title>\n",
       "<text text-anchor=\"middle\" x=\"578.5\" y=\"-188.3\" font-family=\"Times,serif\" font-size=\"14.00\">18 (Loke)</text>\n",
       "</g>\n",
       "<!-- 17&#45;&gt;18 -->\n",
       "<g id=\"edge18\" class=\"edge\">\n",
       "<title>17&#45;&gt;18</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M578.5,-260.8C578.5,-249.16 578.5,-233.55 578.5,-220.24\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"582,-220.18 578.5,-210.18 575,-220.18 582,-220.18\"/>\n",
       "<text text-anchor=\"middle\" x=\"590.5\" y=\"-231.8\" font-family=\"Times,serif\" font-size=\"14.00\">flat</text>\n",
       "</g>\n",
       "<!-- 19 -->\n",
       "<g id=\"node21\" class=\"node\">\n",
       "<title>19</title>\n",
       "<text text-anchor=\"middle\" x=\"578.5\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\">19 (Siew)</text>\n",
       "</g>\n",
       "<!-- 18&#45;&gt;19 -->\n",
       "<g id=\"edge19\" class=\"edge\">\n",
       "<title>18&#45;&gt;19</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M578.5,-173.8C578.5,-162.16 578.5,-146.55 578.5,-133.24\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"582,-133.18 578.5,-123.18 575,-133.18 582,-133.18\"/>\n",
       "<text text-anchor=\"middle\" x=\"590.5\" y=\"-144.8\" font-family=\"Times,serif\" font-size=\"14.00\">flat</text>\n",
       "</g>\n",
       "<!-- 20 -->\n",
       "<g id=\"node22\" class=\"node\">\n",
       "<title>20</title>\n",
       "<text text-anchor=\"middle\" x=\"578.5\" y=\"-14.3\" font-family=\"Times,serif\" font-size=\"14.00\">20 (Fook)</text>\n",
       "</g>\n",
       "<!-- 19&#45;&gt;20 -->\n",
       "<g id=\"edge20\" class=\"edge\">\n",
       "<title>19&#45;&gt;20</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M578.5,-86.8C578.5,-75.16 578.5,-59.55 578.5,-46.24\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"582,-46.18 578.5,-36.18 575,-46.18 582,-46.18\"/>\n",
       "<text text-anchor=\"middle\" x=\"590.5\" y=\"-57.8\" font-family=\"Times,serif\" font-size=\"14.00\">flat</text>\n",
       "</g>\n",
       "<!-- 23 -->\n",
       "<g id=\"node27\" class=\"node\">\n",
       "<title>23</title>\n",
       "<text text-anchor=\"middle\" x=\"381.5\" y=\"-623.3\" font-family=\"Times,serif\" font-size=\"14.00\">23 (khas)</text>\n",
       "</g>\n",
       "<!-- 22&#45;&gt;23 -->\n",
       "<g id=\"edge26\" class=\"edge\">\n",
       "<title>22&#45;&gt;23</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M404.63,-695.8C400.62,-684.05 395.23,-668.24 390.66,-654.84\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"393.9,-653.51 387.36,-645.18 387.28,-655.77 393.9,-653.51\"/>\n",
       "<text text-anchor=\"middle\" x=\"418.5\" y=\"-666.8\" font-family=\"Times,serif\" font-size=\"14.00\">amod</text>\n",
       "</g>\n",
       "<!-- 24 -->\n",
       "<g id=\"node28\" class=\"node\">\n",
       "<title>24</title>\n",
       "<text text-anchor=\"middle\" x=\"491.5\" y=\"-623.3\" font-family=\"Times,serif\" font-size=\"14.00\">24 (kepada)</text>\n",
       "</g>\n",
       "<!-- 25&#45;&gt;24 -->\n",
       "<g id=\"edge27\" class=\"edge\">\n",
       "<title>25&#45;&gt;24</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M561.69,-695.8C548.81,-683.36 531.22,-666.36 516.87,-652.5\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"518.91,-649.61 509.28,-645.18 514.04,-654.64 518.91,-649.61\"/>\n",
       "<text text-anchor=\"middle\" x=\"557.5\" y=\"-666.8\" font-family=\"Times,serif\" font-size=\"14.00\">case</text>\n",
       "</g>\n",
       "<!-- 26 -->\n",
       "<g id=\"node29\" class=\"node\">\n",
       "<title>26</title>\n",
       "<text text-anchor=\"middle\" x=\"605.5\" y=\"-623.3\" font-family=\"Times,serif\" font-size=\"14.00\">26 (ramai)</text>\n",
       "</g>\n",
       "<!-- 25&#45;&gt;26 -->\n",
       "<g id=\"edge28\" class=\"edge\">\n",
       "<title>25&#45;&gt;26</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M584.76,-695.8C588.36,-684.05 593.19,-668.24 597.29,-654.84\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"600.67,-655.76 600.25,-645.18 593.97,-653.71 600.67,-655.76\"/>\n",
       "<text text-anchor=\"middle\" x=\"614.5\" y=\"-666.8\" font-family=\"Times,serif\" font-size=\"14.00\">amod</text>\n",
       "</g>\n",
       "<!-- 29 -->\n",
       "<g id=\"node30\" class=\"node\">\n",
       "<title>29</title>\n",
       "<text text-anchor=\"middle\" x=\"718.5\" y=\"-623.3\" font-family=\"Times,serif\" font-size=\"14.00\">29 (pulang)</text>\n",
       "</g>\n",
       "<!-- 25&#45;&gt;29 -->\n",
       "<g id=\"edge29\" class=\"edge\">\n",
       "<title>25&#45;&gt;29</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M608.69,-695.87C618.22,-690.22 628.84,-683.88 638.5,-678 653.07,-669.12 669.03,-659.19 682.84,-650.53\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"684.96,-653.34 691.56,-645.05 681.24,-647.41 684.96,-653.34\"/>\n",
       "<text text-anchor=\"middle\" x=\"674\" y=\"-666.8\" font-family=\"Times,serif\" font-size=\"14.00\">acl</text>\n",
       "</g>\n",
       "<!-- 35 -->\n",
       "<g id=\"node37\" class=\"node\">\n",
       "<title>35</title>\n",
       "<text text-anchor=\"middle\" x=\"1005.5\" y=\"-623.3\" font-family=\"Times,serif\" font-size=\"14.00\">35 (video)</text>\n",
       "</g>\n",
       "<!-- 46&#45;&gt;35 -->\n",
       "<g id=\"edge45\" class=\"edge\">\n",
       "<title>46&#45;&gt;35</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1093.24,-695.8C1076.69,-683.01 1053.92,-665.42 1035.73,-651.36\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1037.78,-648.52 1027.73,-645.18 1033.5,-654.06 1037.78,-648.52\"/>\n",
       "<text text-anchor=\"middle\" x=\"1078.5\" y=\"-666.8\" font-family=\"Times,serif\" font-size=\"14.00\">obl</text>\n",
       "</g>\n",
       "<!-- 44 -->\n",
       "<g id=\"node46\" class=\"node\">\n",
       "<title>44</title>\n",
       "<text text-anchor=\"middle\" x=\"1115.5\" y=\"-623.3\" font-family=\"Times,serif\" font-size=\"14.00\">44 (Dr)</text>\n",
       "</g>\n",
       "<!-- 46&#45;&gt;44 -->\n",
       "<g id=\"edge46\" class=\"edge\">\n",
       "<title>46&#45;&gt;44</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1115.5,-695.8C1115.5,-684.16 1115.5,-668.55 1115.5,-655.24\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1119,-655.18 1115.5,-645.18 1112,-655.18 1119,-655.18\"/>\n",
       "<text text-anchor=\"middle\" x=\"1135.5\" y=\"-666.8\" font-family=\"Times,serif\" font-size=\"14.00\">nsubj</text>\n",
       "</g>\n",
       "<!-- 47 -->\n",
       "<g id=\"node48\" class=\"node\">\n",
       "<title>47</title>\n",
       "<text text-anchor=\"middle\" x=\"1219.5\" y=\"-623.3\" font-family=\"Times,serif\" font-size=\"14.00\">47 (mereka)</text>\n",
       "</g>\n",
       "<!-- 46&#45;&gt;47 -->\n",
       "<g id=\"edge47\" class=\"edge\">\n",
       "<title>46&#45;&gt;47</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1137.51,-695.65C1144.56,-690.05 1152.38,-683.79 1159.5,-678 1170.04,-669.42 1181.52,-659.9 1191.59,-651.48\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1193.9,-654.11 1199.32,-645.01 1189.41,-648.75 1193.9,-654.11\"/>\n",
       "<text text-anchor=\"middle\" x=\"1189.5\" y=\"-666.8\" font-family=\"Times,serif\" font-size=\"14.00\">obj</text>\n",
       "</g>\n",
       "<!-- 49 -->\n",
       "<g id=\"node49\" class=\"node\">\n",
       "<title>49</title>\n",
       "<text text-anchor=\"middle\" x=\"1370.5\" y=\"-623.3\" font-family=\"Times,serif\" font-size=\"14.00\">49 (berhenti)</text>\n",
       "</g>\n",
       "<!-- 46&#45;&gt;49 -->\n",
       "<g id=\"edge48\" class=\"edge\">\n",
       "<title>46&#45;&gt;49</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1166.8,-695.9C1208.04,-682.15 1266.08,-662.81 1309.66,-648.28\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1310.91,-651.55 1319.29,-645.07 1308.69,-644.91 1310.91,-651.55\"/>\n",
       "<text text-anchor=\"middle\" x=\"1273.5\" y=\"-666.8\" font-family=\"Times,serif\" font-size=\"14.00\">conj</text>\n",
       "</g>\n",
       "<!-- 27 -->\n",
       "<g id=\"node31\" class=\"node\">\n",
       "<title>27</title>\n",
       "<text text-anchor=\"middle\" x=\"528.5\" y=\"-536.3\" font-family=\"Times,serif\" font-size=\"14.00\">27 (yang)</text>\n",
       "</g>\n",
       "<!-- 29&#45;&gt;27 -->\n",
       "<g id=\"edge30\" class=\"edge\">\n",
       "<title>29&#45;&gt;27</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M669.28,-611.43C652,-605.75 632.62,-598.74 615.5,-591 597.98,-583.08 579.4,-572.7 563.93,-563.45\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"565.58,-560.35 555.21,-558.16 561.95,-566.34 565.58,-560.35\"/>\n",
       "<text text-anchor=\"middle\" x=\"635.5\" y=\"-579.8\" font-family=\"Times,serif\" font-size=\"14.00\">nsubj</text>\n",
       "</g>\n",
       "<!-- 28 -->\n",
       "<g id=\"node32\" class=\"node\">\n",
       "<title>28</title>\n",
       "<text text-anchor=\"middle\" x=\"632.5\" y=\"-536.3\" font-family=\"Times,serif\" font-size=\"14.00\">28 (mahu)</text>\n",
       "</g>\n",
       "<!-- 29&#45;&gt;28 -->\n",
       "<g id=\"edge31\" class=\"edge\">\n",
       "<title>29&#45;&gt;28</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M693.71,-608.89C686.57,-603.51 678.96,-597.31 672.5,-591 664.74,-583.43 657.09,-574.37 650.59,-566.06\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"653.36,-563.91 644.52,-558.08 647.79,-568.15 653.36,-563.91\"/>\n",
       "<text text-anchor=\"middle\" x=\"701\" y=\"-579.8\" font-family=\"Times,serif\" font-size=\"14.00\">advmod</text>\n",
       "</g>\n",
       "<!-- 31 -->\n",
       "<g id=\"node33\" class=\"node\">\n",
       "<title>31</title>\n",
       "<text text-anchor=\"middle\" x=\"752.5\" y=\"-536.3\" font-family=\"Times,serif\" font-size=\"14.00\">31 (kampung)</text>\n",
       "</g>\n",
       "<!-- 29&#45;&gt;31 -->\n",
       "<g id=\"edge32\" class=\"edge\">\n",
       "<title>29&#45;&gt;31</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M725.38,-608.8C730.08,-597.05 736.4,-581.24 741.76,-567.84\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"745.17,-568.76 745.63,-558.18 738.67,-566.16 745.17,-568.76\"/>\n",
       "<text text-anchor=\"middle\" x=\"749.5\" y=\"-579.8\" font-family=\"Times,serif\" font-size=\"14.00\">obl</text>\n",
       "</g>\n",
       "<!-- 30 -->\n",
       "<g id=\"node34\" class=\"node\">\n",
       "<title>30</title>\n",
       "<text text-anchor=\"middle\" x=\"699.5\" y=\"-449.3\" font-family=\"Times,serif\" font-size=\"14.00\">30 (ke)</text>\n",
       "</g>\n",
       "<!-- 31&#45;&gt;30 -->\n",
       "<g id=\"edge33\" class=\"edge\">\n",
       "<title>31&#45;&gt;30</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M741.77,-521.8C734.23,-509.7 724.01,-493.3 715.5,-479.67\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"718.47,-477.81 710.21,-471.18 712.53,-481.51 718.47,-477.81\"/>\n",
       "<text text-anchor=\"middle\" x=\"745.5\" y=\"-492.8\" font-family=\"Times,serif\" font-size=\"14.00\">case</text>\n",
       "</g>\n",
       "<!-- 32 -->\n",
       "<g id=\"node35\" class=\"node\">\n",
       "<title>32</title>\n",
       "<text text-anchor=\"middle\" x=\"805.5\" y=\"-449.3\" font-family=\"Times,serif\" font-size=\"14.00\">32 (halaman)</text>\n",
       "</g>\n",
       "<!-- 31&#45;&gt;32 -->\n",
       "<g id=\"edge34\" class=\"edge\">\n",
       "<title>31&#45;&gt;32</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M763.23,-521.8C770.77,-509.7 780.99,-493.3 789.5,-479.67\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"792.47,-481.51 794.79,-471.18 786.53,-477.81 792.47,-481.51\"/>\n",
       "<text text-anchor=\"middle\" x=\"819.5\" y=\"-492.8\" font-family=\"Times,serif\" font-size=\"14.00\">compound</text>\n",
       "</g>\n",
       "<!-- 34 -->\n",
       "<g id=\"node36\" class=\"node\">\n",
       "<title>34</title>\n",
       "<text text-anchor=\"middle\" x=\"876.5\" y=\"-536.3\" font-family=\"Times,serif\" font-size=\"14.00\">34 (Dalam)</text>\n",
       "</g>\n",
       "<!-- 35&#45;&gt;34 -->\n",
       "<g id=\"edge35\" class=\"edge\">\n",
       "<title>35&#45;&gt;34</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M979.39,-608.8C959.72,-595.84 932.56,-577.94 911.09,-563.79\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"912.84,-560.75 902.57,-558.18 908.99,-566.6 912.84,-560.75\"/>\n",
       "<text text-anchor=\"middle\" x=\"965.5\" y=\"-579.8\" font-family=\"Times,serif\" font-size=\"14.00\">case</text>\n",
       "</g>\n",
       "<!-- 36 -->\n",
       "<g id=\"node38\" class=\"node\">\n",
       "<title>36</title>\n",
       "<text text-anchor=\"middle\" x=\"992.5\" y=\"-536.3\" font-family=\"Times,serif\" font-size=\"14.00\">36 (pendek)</text>\n",
       "</g>\n",
       "<!-- 35&#45;&gt;36 -->\n",
       "<g id=\"edge36\" class=\"edge\">\n",
       "<title>35&#45;&gt;36</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1002.87,-608.8C1001.09,-597.16 998.7,-581.55 996.67,-568.24\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1000.1,-567.53 995.13,-558.18 993.18,-568.59 1000.1,-567.53\"/>\n",
       "<text text-anchor=\"middle\" x=\"1020.5\" y=\"-579.8\" font-family=\"Times,serif\" font-size=\"14.00\">amod</text>\n",
       "</g>\n",
       "<!-- 37 -->\n",
       "<g id=\"node39\" class=\"node\">\n",
       "<title>37</title>\n",
       "<text text-anchor=\"middle\" x=\"1114.5\" y=\"-536.3\" font-family=\"Times,serif\" font-size=\"14.00\">37 (terbitan)</text>\n",
       "</g>\n",
       "<!-- 35&#45;&gt;37 -->\n",
       "<g id=\"edge37\" class=\"edge\">\n",
       "<title>35&#45;&gt;37</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1027.56,-608.8C1043.96,-596.01 1066.52,-578.42 1084.55,-564.36\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1086.74,-567.08 1092.48,-558.18 1082.44,-561.56 1086.74,-567.08\"/>\n",
       "<text text-anchor=\"middle\" x=\"1104.5\" y=\"-579.8\" font-family=\"Times,serif\" font-size=\"14.00\">compound</text>\n",
       "</g>\n",
       "<!-- 38 -->\n",
       "<g id=\"node40\" class=\"node\">\n",
       "<title>38</title>\n",
       "<text text-anchor=\"middle\" x=\"1046.5\" y=\"-449.3\" font-family=\"Times,serif\" font-size=\"14.00\">38 (Jabatan)</text>\n",
       "</g>\n",
       "<!-- 37&#45;&gt;38 -->\n",
       "<g id=\"edge38\" class=\"edge\">\n",
       "<title>37&#45;&gt;38</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1100.74,-521.8C1090.97,-509.59 1077.69,-492.99 1066.72,-479.28\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1069.22,-476.8 1060.24,-471.18 1063.75,-481.17 1069.22,-476.8\"/>\n",
       "<text text-anchor=\"middle\" x=\"1097.5\" y=\"-492.8\" font-family=\"Times,serif\" font-size=\"14.00\">flat</text>\n",
       "</g>\n",
       "<!-- 43 -->\n",
       "<g id=\"node41\" class=\"node\">\n",
       "<title>43</title>\n",
       "<text text-anchor=\"middle\" x=\"1153.5\" y=\"-449.3\" font-family=\"Times,serif\" font-size=\"14.00\">43 (itu,)</text>\n",
       "</g>\n",
       "<!-- 37&#45;&gt;43 -->\n",
       "<g id=\"edge39\" class=\"edge\">\n",
       "<title>37&#45;&gt;43</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1122.39,-521.8C1127.84,-509.93 1135.18,-493.93 1141.36,-480.45\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1144.63,-481.72 1145.62,-471.18 1138.27,-478.8 1144.63,-481.72\"/>\n",
       "<text text-anchor=\"middle\" x=\"1148.5\" y=\"-492.8\" font-family=\"Times,serif\" font-size=\"14.00\">det</text>\n",
       "</g>\n",
       "<!-- 39 -->\n",
       "<g id=\"node42\" class=\"node\">\n",
       "<title>39</title>\n",
       "<text text-anchor=\"middle\" x=\"1046.5\" y=\"-362.3\" font-family=\"Times,serif\" font-size=\"14.00\">39 (Keselamatan)</text>\n",
       "</g>\n",
       "<!-- 38&#45;&gt;39 -->\n",
       "<g id=\"edge40\" class=\"edge\">\n",
       "<title>38&#45;&gt;39</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1046.5,-434.8C1046.5,-423.16 1046.5,-407.55 1046.5,-394.24\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1050,-394.18 1046.5,-384.18 1043,-394.18 1050,-394.18\"/>\n",
       "<text text-anchor=\"middle\" x=\"1058.5\" y=\"-405.8\" font-family=\"Times,serif\" font-size=\"14.00\">flat</text>\n",
       "</g>\n",
       "<!-- 40 -->\n",
       "<g id=\"node43\" class=\"node\">\n",
       "<title>40</title>\n",
       "<text text-anchor=\"middle\" x=\"1046.5\" y=\"-275.3\" font-family=\"Times,serif\" font-size=\"14.00\">40 (Jalan)</text>\n",
       "</g>\n",
       "<!-- 39&#45;&gt;40 -->\n",
       "<g id=\"edge41\" class=\"edge\">\n",
       "<title>39&#45;&gt;40</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1046.5,-347.8C1046.5,-336.16 1046.5,-320.55 1046.5,-307.24\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1050,-307.18 1046.5,-297.18 1043,-307.18 1050,-307.18\"/>\n",
       "<text text-anchor=\"middle\" x=\"1058.5\" y=\"-318.8\" font-family=\"Times,serif\" font-size=\"14.00\">flat</text>\n",
       "</g>\n",
       "<!-- 41 -->\n",
       "<g id=\"node44\" class=\"node\">\n",
       "<title>41</title>\n",
       "<text text-anchor=\"middle\" x=\"1046.5\" y=\"-188.3\" font-family=\"Times,serif\" font-size=\"14.00\">41 (Raya)</text>\n",
       "</g>\n",
       "<!-- 40&#45;&gt;41 -->\n",
       "<g id=\"edge42\" class=\"edge\">\n",
       "<title>40&#45;&gt;41</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1046.5,-260.8C1046.5,-249.16 1046.5,-233.55 1046.5,-220.24\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1050,-220.18 1046.5,-210.18 1043,-220.18 1050,-220.18\"/>\n",
       "<text text-anchor=\"middle\" x=\"1058.5\" y=\"-231.8\" font-family=\"Times,serif\" font-size=\"14.00\">flat</text>\n",
       "</g>\n",
       "<!-- 42 -->\n",
       "<g id=\"node45\" class=\"node\">\n",
       "<title>42</title>\n",
       "<text text-anchor=\"middle\" x=\"1046.5\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\">42 ((JKJR))</text>\n",
       "</g>\n",
       "<!-- 41&#45;&gt;42 -->\n",
       "<g id=\"edge43\" class=\"edge\">\n",
       "<title>41&#45;&gt;42</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1046.5,-173.8C1046.5,-162.16 1046.5,-146.55 1046.5,-133.24\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1050,-133.18 1046.5,-123.18 1043,-133.18 1050,-133.18\"/>\n",
       "<text text-anchor=\"middle\" x=\"1058.5\" y=\"-144.8\" font-family=\"Times,serif\" font-size=\"14.00\">flat</text>\n",
       "</g>\n",
       "<!-- 45 -->\n",
       "<g id=\"node47\" class=\"node\">\n",
       "<title>45</title>\n",
       "<text text-anchor=\"middle\" x=\"1244.5\" y=\"-536.3\" font-family=\"Times,serif\" font-size=\"14.00\">45 (Mahathir)</text>\n",
       "</g>\n",
       "<!-- 44&#45;&gt;45 -->\n",
       "<g id=\"edge44\" class=\"edge\">\n",
       "<title>44&#45;&gt;45</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1141.61,-608.8C1161.28,-595.84 1188.44,-577.94 1209.91,-563.79\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1212.01,-566.6 1218.43,-558.18 1208.16,-560.75 1212.01,-566.6\"/>\n",
       "<text text-anchor=\"middle\" x=\"1200.5\" y=\"-579.8\" font-family=\"Times,serif\" font-size=\"14.00\">flat</text>\n",
       "</g>\n",
       "<!-- 48 -->\n",
       "<g id=\"node50\" class=\"node\">\n",
       "<title>48</title>\n",
       "<text text-anchor=\"middle\" x=\"1370.5\" y=\"-536.3\" font-family=\"Times,serif\" font-size=\"14.00\">48 (supaya)</text>\n",
       "</g>\n",
       "<!-- 49&#45;&gt;48 -->\n",
       "<g id=\"edge49\" class=\"edge\">\n",
       "<title>49&#45;&gt;48</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1370.5,-608.8C1370.5,-597.16 1370.5,-581.55 1370.5,-568.24\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1374,-568.18 1370.5,-558.18 1367,-568.18 1374,-568.18\"/>\n",
       "<text text-anchor=\"middle\" x=\"1378.5\" y=\"-579.8\" font-family=\"Times,serif\" font-size=\"14.00\">cc</text>\n",
       "</g>\n",
       "<!-- 50 -->\n",
       "<g id=\"node51\" class=\"node\">\n",
       "<title>50</title>\n",
       "<text text-anchor=\"middle\" x=\"1491.5\" y=\"-536.3\" font-family=\"Times,serif\" font-size=\"14.00\">50 (berehat)</text>\n",
       "</g>\n",
       "<!-- 49&#45;&gt;50 -->\n",
       "<g id=\"edge50\" class=\"edge\">\n",
       "<title>49&#45;&gt;50</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1394.99,-608.8C1413.35,-595.9 1438.69,-578.1 1458.79,-563.98\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1460.88,-566.79 1467.05,-558.18 1456.86,-561.06 1460.88,-566.79\"/>\n",
       "<text text-anchor=\"middle\" x=\"1462\" y=\"-579.8\" font-family=\"Times,serif\" font-size=\"14.00\">xcomp</text>\n",
       "</g>\n",
       "<!-- 52 -->\n",
       "<g id=\"node52\" class=\"node\">\n",
       "<title>52</title>\n",
       "<text text-anchor=\"middle\" x=\"1491.5\" y=\"-449.3\" font-family=\"Times,serif\" font-size=\"14.00\">52 (tidur)</text>\n",
       "</g>\n",
       "<!-- 50&#45;&gt;52 -->\n",
       "<g id=\"edge51\" class=\"edge\">\n",
       "<title>50&#45;&gt;52</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1491.5,-521.8C1491.5,-510.16 1491.5,-494.55 1491.5,-481.24\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1495,-481.18 1491.5,-471.18 1488,-481.18 1495,-481.18\"/>\n",
       "<text text-anchor=\"middle\" x=\"1506.5\" y=\"-492.8\" font-family=\"Times,serif\" font-size=\"14.00\">conj</text>\n",
       "</g>\n",
       "<!-- 51 -->\n",
       "<g id=\"node53\" class=\"node\">\n",
       "<title>51</title>\n",
       "<text text-anchor=\"middle\" x=\"1460.5\" y=\"-362.3\" font-family=\"Times,serif\" font-size=\"14.00\">51 (dan)</text>\n",
       "</g>\n",
       "<!-- 52&#45;&gt;51 -->\n",
       "<g id=\"edge52\" class=\"edge\">\n",
       "<title>52&#45;&gt;51</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1485.23,-434.8C1480.94,-423.05 1475.18,-407.24 1470.29,-393.84\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1473.48,-392.37 1466.76,-384.18 1466.9,-394.77 1473.48,-392.37\"/>\n",
       "<text text-anchor=\"middle\" x=\"1486.5\" y=\"-405.8\" font-family=\"Times,serif\" font-size=\"14.00\">cc</text>\n",
       "</g>\n",
       "<!-- 55 -->\n",
       "<g id=\"node54\" class=\"node\">\n",
       "<title>55</title>\n",
       "<text text-anchor=\"middle\" x=\"1581.5\" y=\"-362.3\" font-family=\"Times,serif\" font-size=\"14.00\">55 (mengantuk)</text>\n",
       "</g>\n",
       "<!-- 52&#45;&gt;55 -->\n",
       "<g id=\"edge53\" class=\"edge\">\n",
       "<title>52&#45;&gt;55</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1509.71,-434.8C1523.01,-422.24 1541.21,-405.05 1555.96,-391.12\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1558.45,-393.59 1563.31,-384.18 1553.64,-388.5 1558.45,-393.59\"/>\n",
       "<text text-anchor=\"middle\" x=\"1566\" y=\"-405.8\" font-family=\"Times,serif\" font-size=\"14.00\">xcomp</text>\n",
       "</g>\n",
       "<!-- 53 -->\n",
       "<g id=\"node55\" class=\"node\">\n",
       "<title>53</title>\n",
       "<text text-anchor=\"middle\" x=\"1447.5\" y=\"-275.3\" font-family=\"Times,serif\" font-size=\"14.00\">53 (sebentar)</text>\n",
       "</g>\n",
       "<!-- 55&#45;&gt;53 -->\n",
       "<g id=\"edge54\" class=\"edge\">\n",
       "<title>55&#45;&gt;53</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1554.38,-347.8C1533.86,-334.78 1505.48,-316.78 1483.13,-302.6\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1484.9,-299.58 1474.58,-297.18 1481.15,-305.49 1484.9,-299.58\"/>\n",
       "<text text-anchor=\"middle\" x=\"1539.5\" y=\"-318.8\" font-family=\"Times,serif\" font-size=\"14.00\">case</text>\n",
       "</g>\n",
       "<!-- 54 -->\n",
       "<g id=\"node56\" class=\"node\">\n",
       "<title>54</title>\n",
       "<text text-anchor=\"middle\" x=\"1581.5\" y=\"-275.3\" font-family=\"Times,serif\" font-size=\"14.00\">54 (sekiranya)</text>\n",
       "</g>\n",
       "<!-- 55&#45;&gt;54 -->\n",
       "<g id=\"edge55\" class=\"edge\">\n",
       "<title>55&#45;&gt;54</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1581.5,-347.8C1581.5,-336.16 1581.5,-320.55 1581.5,-307.24\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1585,-307.18 1581.5,-297.18 1578,-307.18 1585,-307.18\"/>\n",
       "<text text-anchor=\"middle\" x=\"1610\" y=\"-318.8\" font-family=\"Times,serif\" font-size=\"14.00\">advmod</text>\n",
       "</g>\n",
       "<!-- 57 -->\n",
       "<g id=\"node57\" class=\"node\">\n",
       "<title>57</title>\n",
       "<text text-anchor=\"middle\" x=\"1721.5\" y=\"-275.3\" font-family=\"Times,serif\" font-size=\"14.00\">57 (memandu.)</text>\n",
       "</g>\n",
       "<!-- 55&#45;&gt;57 -->\n",
       "<g id=\"edge56\" class=\"edge\">\n",
       "<title>55&#45;&gt;57</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1611.75,-347.99C1621.61,-342.35 1632.57,-335.99 1642.5,-330 1656.98,-321.27 1672.76,-311.36 1686.38,-302.69\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1688.44,-305.52 1694.98,-297.18 1684.67,-299.62 1688.44,-305.52\"/>\n",
       "<text text-anchor=\"middle\" x=\"1686.5\" y=\"-318.8\" font-family=\"Times,serif\" font-size=\"14.00\">advcl</text>\n",
       "</g>\n",
       "<!-- 56 -->\n",
       "<g id=\"node58\" class=\"node\">\n",
       "<title>56</title>\n",
       "<text text-anchor=\"middle\" x=\"1721.5\" y=\"-188.3\" font-family=\"Times,serif\" font-size=\"14.00\">56 (ketika)</text>\n",
       "</g>\n",
       "<!-- 57&#45;&gt;56 -->\n",
       "<g id=\"edge57\" class=\"edge\">\n",
       "<title>57&#45;&gt;56</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1721.5,-260.8C1721.5,-249.16 1721.5,-233.55 1721.5,-220.24\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1725,-220.18 1721.5,-210.18 1718,-220.18 1725,-220.18\"/>\n",
       "<text text-anchor=\"middle\" x=\"1740\" y=\"-231.8\" font-family=\"Times,serif\" font-size=\"14.00\">mark</text>\n",
       "</g>\n",
       "</g>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<graphviz.files.Source at 0x7f3222937fa0>"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tagging, indexing = malaya.stack.voting_stack([tiny, small, small], string)\n",
    "malaya.dependency.dependency_graph(tagging, indexing).to_graphvis()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
